<template>
<!--  组件的结构-->
  <div class="student">
    <h2 >学生姓名：{{ name }}</h2>
    <h2>学生性别：{{ sex }}</h2>
    <button @click="sentStudentName">把学生名给school</button>
  </div>
</template>
<script>
import pubsub from "pubsub-js";
export default {
  name:'Student',
  data() {
    return {
      sex:'男',
      name:'张三',
    }
  },
  mounted() {
  },
  methods:{
    sentStudentName(){
      pubsub.publish('hello',666)
    }

  }
}
</script>
<style lang="less">
/*组件的样式*/
.student{
  background-color: #b71e1e;
  padding: 5px;
  margin-top: 30px;
}
</style>